<h1>Tours View</h1>
<div id="infomessage" style="display: none;"></div>
<div>
    <table class="tablesorter" id="carviews" cellpadding="0" cellspacing="0" width="100%">
        <thead>
            <tr>
                <!--<th width="30" style="text-align: center;">ID</th>-->
                <th width="85" style="text-align: center;">Photo</th>
                <th>Tour name</th>
                <th>Info</th>
                <th>Status</th>
                <th width="220" style="text-align: center;">Action</th>
            </tr> 
        </thead>
        <tbody>
            <? foreach($tours as $tour): ?>
                <tr>
                    <!--<td style="text-align: center;"><?=$tour['id']?></td>-->
                    <td style="text-align: center;">                       
                        
                        <?
                            $image = $this->db->get_where('tourimg',array('tours_id' => $tour['id']))->result_array();
                            if(isset($image[0]['url'])){
                                ?>
                                    <img src="<?=base_url()?>assets/img/tours/<?=$image[0]['url']?>.jpg" alt="tour_<?=$tour['id']?>" style="padding: 1px; border: 1px solid #f1f1f1; width: 82px;" />
                                <?
                            }else echo "No image";
                        ?>
                        
                    </td>
                    <td class="exc_title"><strong><?=$tour['title']?></strong></td>
                    <td style="line-height: 16px;" class="exc_info">
                        Price per person in 1/2 room : <?=$tour['Cena Dvokrevetne']?>&euro;<br />
                        Price per person in 1/1 room : <?=$tour['Cena Jednokrevetne']?>&euro;<br />
                        Capacity: <?=$tour['capacity']?> persons
                    </td>
                    <td style="vertical-align: middle; text-align: center;">
                        <?
                            switch ($tour['status']){
                                case 0:
                                ?>
                                <img src="<?=base_url()?>assets/img/backgrounds/item-closed.png" alt="Excursion closed"  />
                                <?
                                    break;
                                case 1:
                                ?>
                                <img src="<?=base_url()?>assets/img/backgrounds/item-open.png" alt="Excursion open"  /> 
                                <?
                                    break;
                            }
                        ?>
                    </td>
                    <td style="text-align: center; padding-top:4px" class="actiontd">
                        <a href="<?=site_url().'tours/tours/edit/'.$tour['id'];?>" class="edit_grid" id="<?=$tour['id']?>">Uredi</a>
                        <a href="javascript:void(null);" class="delete_grid" id="tr_<?=$tour['id']?>">Briši</a>
                        <a href="<?=base_url()?>image/addnew_form_tours/<?=$tour['id'];?>" class="add_foto">Slika</a>
                        <?
                            switch ($tour['status']){
                                case 0:
                                ?>
                                <a href="<?=base_url()?>tours/tours/set_status/<?=$tour['id'];?>/1" class="set_status">Aktiviraj</a>    
                                <?
                                    break;
                                case 1:
                                ?>
                                <a href="<?=base_url()?>tours/tours/set_status/<?=$tour['id'];?>/0" class="set_status">Dektiviraj</a>    
                                <?
                                    break;
                            }
                        ?>
                    </td>
                </tr>
                <? endforeach;  ?>
        </tbody>
    </table>
</div>